import { serviceCreate } from '../utils/request'
import { merge } from 'axios/lib/utils'
const http = serviceCreate({
  // baseURL: '/dv',
  // 表单提交
  emulateJSON: true
})
// @config {headers, emulateJSON, loading, msg, errMsg, disableInterceptor}
const methods = {
    // 获取详细
    getDetail (params, config) {
        params = merge({
            id: ''
        }, params || {})
        return http.get('/bangumi/info', merge(config, { params }))
    },
    // 获取播放地址
    getPlayUrl (params, config) {
        params = merge({
            ep_id: '',
            bsource: '',
        }, params || {})
        return http.get('/bangumi/playurl', merge(config, { params }))
    },
    // 获取相关番剧
    getRelated (params, config) {
        params = merge({
            season_id: '',
            from_pc: 0,
        }, params || {})
        return http.get('/bangumi/related', merge(config, { params }))
    },
    // 获取评论
    getComment (params, config) {
        params = merge({
            oid: '',
            type: 1,
            sort: 2,
            pn: 1,
            nohot: 1
        }, params || {})
        return http.get('/bangumi/comment', merge(config, { params }))
    }
}

export default methods
